package com.sdy.healthcode.biz.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sdy.common.utils.DateUtil;
import com.sdy.healthcode.biz.dto.PersonMana;
import com.sdy.healthcode.biz.model.ApplyPost;
import com.sdy.healthcode.biz.mapper.ApplyPostMapper;
import com.sdy.healthcode.biz.service.ApplyPostService;
import com.sdy.mvc.service.impl.BaseServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zzq
 * @since 2020-02-18
 */
@Slf4j
@Service
public class ApplyPostServiceImpl extends BaseServiceImpl<ApplyPost> implements ApplyPostService {
    @Autowired
    private ApplyPostMapper applyPostMapper;

    @Override
    public ApplyPost queryApplyPost(Integer userId) {
        return lambdaQuery()
                .eq(ApplyPost::getUserId, userId)
                .in(ApplyPost::getState, 1)
                .one();
    }

    @Override
    public List<PersonMana> getPersonals(Integer type, Integer healthStatus, String name, String startTime, String endTime, Page page) {
        return applyPostMapper.getPersonals(type, healthStatus, name, startTime, endTime, page);
    }

    @Override
    public Integer getPersonCount(Integer type, Integer healthStatus, String name, String startTime, String endTime) {
        return applyPostMapper.getPersonCount(type, healthStatus, name, startTime, endTime);
    }

}
